# 使用官方的 .NET 6 SDK 作为基础镜像
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app

# 复制项目文件并生成
COPY ["export/export.csproj", "export/"]
COPY ["netcore_service/netcore_service.csproj", "netcore_service/"]
COPY ["netcore_comm/netcore_comm.csproj", "netcore_comm/"]
RUN dotnet resotre "export/export.csproj"

COPY . ./
WORKDIR "/export"

RUN dotnet publish -c Release -o out

# 使用一个轻量级的运行时镜像作为最终镜像
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /app/out ./

# 指定容器启动时运行的命令
ENTRYPOINT ["dotnet", "export.dll"]
